import 'package:qr_code_app/common/service/app_data.dart';
import 'package:todo_flutter/todo_flutter.dart';

class ApiInterceptor extends InterceptorsWrapper {
  @override
  Future<void> onRequest(
    RequestOptions options,
    RequestInterceptorHandler handler,
  ) async {
    final token = AppData.getToken();
    if (token != null) {
      options.headers['Authorization'] = 'Bearer ${token}';
    }
    handler.next(options);
  }
}
